package ooday02;
//方法重写的演示
public class OverrideDemo {
    public static void main(String[] args) {
        //重写方法被调用时，看对象类型的执行方法（new谁就调谁）
        Student ll = new Student("李林",20,"北京","2408","001");
        ll.sayHi(); //调用Student重写之后的
        Teacher ww = new Teacher("王五",30,"上海",5000);
        ww.sayHi(); //调用Teacher重写之后的
        Doctor ls = new Doctor("李四",50,"陕西","医生");
        ls.sayHi(); //调用Person中的
    }
}
